package com.example.libraryapp.user;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * 用户信息类
 */
public class UserInfo implements Parcelable{
    private static final String TAG = "UserInfo";


    private int urid;
    private String cardid;	//借记卡号
    private String username;	//用户昵称
    private String password;
    

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public int getUrid() {
		return urid;
	}

	public void setUrid(int urid) {
		this.urid = urid;
	}

	
	public String getCardid() {
		return cardid;
	}

	public void setCardid(String cardid) {
		this.cardid = cardid;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	/**
     * 序列化实体类
     */
    public static final Parcelable.Creator<UserInfo> CREATOR = new Creator<UserInfo>() {
        @Override
        public UserInfo createFromParcel(Parcel parcel) {
            UserInfo userInfo = new UserInfo();
            userInfo.urid = parcel.readInt();
            userInfo.cardid = parcel.readString();
            userInfo.username = parcel.readString();
            userInfo.password = parcel.readString();
            return userInfo;
        }

        @Override
        public UserInfo[] newArray(int i) {
            return new UserInfo[i];
        }
    };

    @Override
    public int describeContents() {
        return 0;
    }

    /**
     * 把实体类写到Parcel中
     * @param parcel
     * @param i
     */
    @Override
    public void writeToParcel(Parcel parcel, int i) {
        parcel.writeInt(urid);
        parcel.writeString(cardid);
        parcel.writeString(password);
        parcel.writeString(username);
    }

}
